package com.bjsxt.base.sync_shuoGG;

import java.text.SimpleDateFormat;
import java.util.Date;

/*
现象: A线程运行test1期间, B线程无法运行test1
    Thread-0 ThreadStatic1 14:56:48
    main UseLock StaticUtil.test1 14:56:48
    main ReleaseLock StaticUtil.test1 14:56:53
    Thread-0 UseLock StaticUtil.test1 14:56:53
    Thread-0 ReleaseLock StaticUtil.test1 14:56:58
*/
public class ThreadStatic1 extends Thread {

    @Override
    public void run() {
        System.out.println(currentThread().getName() + " ThreadStatic1 " + new SimpleDateFormat("HH:mm:ss").format(new Date()));
        StaticUtil.test1();
    }

    public static void main(String[] args) {
        new ThreadStatic1().start();
        StaticUtil.test1();
    }
}
